﻿namespace _2_NovaAdmin.Application.EventHandlers.UserCreated;

public class UserCreatedDomainEventHandler : IDomainEventHandler<UserCreatedDomainEvent>
{
    ICapPublisher _capPublisher;
    public UserCreatedDomainEventHandler(ICapPublisher capPublisher)
    {
        _capPublisher = capPublisher;
    }

    public async Task Handle(UserCreatedDomainEvent notification, CancellationToken cancellationToken)
    {
        // 响应领域事件：发送用户
        await _capPublisher.PublishAsync("user.created", notification.user);
    }
}
